ES环境搭建
Docker安装es
Install Elasticsearch with Docker
es 建议先手动安装. head 插件可以使用doker创建
1 | docker pull elasticsearch |
使用另外一个镜像做head插件
1 | docker run --name elasticsearch-head -d -p 9100:9100 mobz/elasticsearch-head:5 |
使用docker可视化界面管理容器
1 | docker run --name docker-ui -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock uifd/ui-for-docker |
安装kibana
1 | docker run -it -d -e ELASTICSEARCH_URL=http://127.0.0.1:9200 --name kibana -p 5601:5601 kibana:5.6.12 |
版本和es最好对应,这里还注意127.0.0.1是有问题,docker内部的127会访问不到外部
ES本地安装包安装
下载 elasticsearch-6.3.2.tar.gz.
1 | wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.zip |
解压后:修改配置文件,添加
1 | http.cors.enabled: true |
上述是由于head插件和es 之间存在跨域问题(两个进程),需要给权限 https://www.jianshu.com/p/f80fb1dd842b
如果需要其他网络可以访问(不是同一个地址),需要设置如下:
1 | network.host: 0.0.0.0 |
这个时候可能会启动失败,解决:https://www.cnblogs.com/phpper/p/9803934.html
https://www.cnblogs.com/hongdada/p/7887455.html
修改后重启吧,很恶心.(目前找到的资料是只能重启)
终极解决方案,新建用户.应该是当前用户有限制,会覆盖系统设置的max file limit.
或者好用的
1 | 非常简单好用 |
1 | # 启动 |
安装插件analysis-ik
1 | ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.3.2/elasticsearch-analysis-ik-6.3.2.zip |
https://github.com/medcl/elasticsearch-analysis-ik
安装sql插件
1 | ./bin/elasticsearch-plugin install https://github.com/NLPchina/elasticsearch-sql/releases/download/6.3.2.0/elasticsearch-sql-6.3.2.0.zip |
https://github.com/NLPchina/elasticsearch-sql
其他插件
https://www.elastic.co/guide/en/elasticsearch/plugins/6.3/analysis.html
安装kibana
1 | wget https://artifacts.elastic.co/downloads/kibana/kibana-6.3.2-linux-x86_64.tar.gz |